package com.sskj.xgja.login;

import com.sskj.xgja.BasePresenter;
import com.sskj.xgja.api.ApiObserver;
import com.sskj.base.utils.RxUtils;
import com.sskj.xgja.api.Api;


/**
 * @author Hey
 * Create at  2019/03/21
 */
class ForgetPasswordPresenter extends BasePresenter<ForgetPasswordActivity> {

    public void sendCode(String account) {
        Api.getInstance().getCode("2", account)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<String>(this, true) {
                    @Override
                    public void onSuccess(String data) {
                        mView.sendCodeSuccess();
                    }
                });
    }

    public void resetPassword(String account, String ps, String ps2, String code) {
        Api.getInstance().resetPassword(account, code, ps, ps2)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<String>(this, true) {
                    @Override
                    public void onSuccess(String data) {
                        mView.resetPasswordSuccess();
                    }
                });
    }
}
